#include <cstdio>  // 包含 printf 函数的定义
#include <cstdint> // 包含 int8_t 等固定宽度整数类型的定义

namespace PORTING_UNSIGNEDCHAR_OVERFLOW_FALSE {

	namespace bad {
		int has_utf8_byte_order_mark(char* s) {
			return s[0] == 0xEF && s[1] == 0xBB && s[2] == 0xBF;
		}
		int main() {
			char* s = (char*)"\xEF\xBB\xBFHello, World!\n";
			if (has_utf8_byte_order_mark(s)) {
				printf("unicode\n");
			}
			else {
				printf("not unicode\n");
			}
			return 0;
		}
	}

	namespace good_1 {
		int has_utf8_byte_order_mark(char* s) {
			return s[0] == '\xEF' && s[1] == '\xBB' && s[2] == '\xBF';
		}
		int main() {
			char* s = (char*)"\xEF\xBB\xBFHello, World!\n";
			if (has_utf8_byte_order_mark(s)) {
				printf("unicode\n");
			}
			else {
				printf("not unicode\n");
			}
			return 0;
		}
	}

	namespace good_2 {
		int has_utf8_byte_order_mark(unsigned char* s) {
			return s[0] == 0xEF && s[1] == 0xBB && s[2] == 0xBF;
		}
		int main() {
			unsigned char* s = (unsigned char*)"\xEF\xBB\xBFHello, World!\n";
			if (has_utf8_byte_order_mark(s)) {
				printf("unicode\n");
			}
			else {
				printf("not unicode\n");
			}
			return 0;
		}
	}
}